<template>
  <div>
    <a-card>
      <a-row style="margin-bottom: 10px">
        <a-col :span="24"  style="display: flex;flex-direction: row-reverse">
          <a-button v-print="'#printReport'" type="primary">打印报表</a-button>
        </a-col>
      </a-row>
      <div id="printReport">
        <table border="1" cellpadding="4" cellspacing="0" bordercolor="#000" style="width: 100%">
          <tr>
            <th colspan="33">
              <div style="position: relative;text-align: center">
                <span>{{reportData.title}}</span>
<!--                <span style="position: absolute;right: 0px;top:0px">2019年12月</span>-->
              </div>
            </th>
          </tr>
          <tr>
            <td colspan="2">线别：{{ reportData.lineType }}</td>
            <td colspan="8">设备名称：{{ reportData.equipmentName }}</td>
            <td colspan="7">文件编号：{{ reportData.documentNumber }}</td>
            <td colspan="8">日期：{{ reportData.datePurchase }}</td>
            <td colspan="8">{{reportData.accountingMethod}}</td>
          </tr>
          <tr v-if="reportData.dayCheckName.length > 0">
            <td :rowspan="reportData.dayCheckName.length + 1">日保养</td>
            <td>点检项目</td>
            <td v-for="i in 31">{{ i }}</td>
          </tr>
          <tr v-for="(item,index) in reportData.dayCheckName" v-if="reportData.dayCheckName.length > 0">
            <td>{{item}}</td>
            <td v-for="fileds in reportData.dayCheckList[index]">{{fileds.inspectionResults}}</td>
          </tr>
          <tr v-if="reportData.weekCheckName.length > 0">
            <td :rowspan="reportData.weekCheckName.length + 1">周保养</td>
            <td>检查项目</td>

            <td colspan="2" :rowspan="reportData.weekCheckName.length + 1">第一周</td>
            <td colspan="2">保养人</td>
            <td colspan="3">{{ reportData.weekCheckList[0][0].maintainer }}</td>

            <td colspan="2" :rowspan="reportData.weekCheckName.length + 1">第二周</td>
            <td colspan="2">保养人</td>
            <td colspan="4">{{ reportData.weekCheckList[0][1].maintainer }}</td>

            <td colspan="2" :rowspan="reportData.weekCheckName.length + 1">第三周</td>
            <td colspan="2">保养人</td>
            <td colspan="4">{{ reportData.weekCheckList[0][2].maintainer }}</td>

            <td colspan="2" :rowspan="reportData.weekCheckName.length + 1">第四周</td>
            <td colspan="2">保养人</td>
            <td colspan="4">{{ reportData.weekCheckList[0][3].maintainer }}</td>
          </tr>

          <tr v-for="(item,index) in reportData.weekCheckName" v-if="reportData.weekCheckName.length > 0">
            <td>{{item}}</td>

            <td colspan="5">{{reportData.weekCheckList[index][0].inspectionResults}}</td>

            <td colspan="6">{{reportData.weekCheckList[index][1].inspectionResults}}</td>

            <td colspan="6">{{reportData.weekCheckList[index][2].inspectionResults}}</td>

            <td colspan="6">{{reportData.weekCheckList[index][3].inspectionResults}}</td>
          </tr>

          <tr v-if="reportData.monthCheckName.length > 0">
            <td :rowspan="reportData.monthCheckName.length + 1">月保养</td>
            <td>保养项目</td>
            <td colspan="27">完成在对应栏中打"√"未完成打"X",如有异常请阐述</td>
            <td colspan="4">保养人</td>
          </tr>
          <tr v-if="reportData.monthCheckName.length > 0">
            <td>{{reportData.monthCheckName[0]}}</td>
            <td colspan="27">{{reportData.monthCheckList[0][0].inspectionResults}}</td>
            <td colspan="4" :rowspan="reportData.monthCheckName.length">{{reportData.monthCheckList[0][0].maintainer}}</td>
          </tr>
          <tr v-for="(item,index) in reportData.monthCheckName.slice(1)" v-if="reportData.monthCheckName.length > 0">
            <td>{{item}}</td>
            <td colspan="27">{{reportData.monthCheckList[index+1][0].inspectionResults}}</td>
          </tr>
          <tr>
            <td colspan="2">注意事项</td>
            <td colspan="31">
              {{reportData.beCareful}}
<!--              1.日保养由产线作业员上班前进行确认,周保养及月保养由技术员进行定期确认<br/>-->
<!--              2.点检注意安全，点检完及时记录并签字确认<br/>-->
<!--              3.设备未生产时，做设备表面清洁-->
            </td>
          </tr>
        </table>
      </div>
    </a-card>
  </div>
</template>

<script>
export default {
  /** 印刷机日常维护点检表（SPI、印刷机、AOI） **/
  name: 'DailySpotCheckAndMaintenance',
  props:{
    reportData:{
      type:Object,
      default:()=>{}
    },
    type:{
      type:String,
      default:''
    }
  },
  data(){
    return {

    }
  }
}
</script>

<style scoped>

</style>